import Cookies from "js-cookie"

const USER_INFO = "user_info"

const LOGIN_SID = "sid"

export const getInfo = () => {
    let userInfo = localStorage.getItem(USER_INFO)
    return userInfo ? JSON.parse(userInfo) : {sid: '', loginName: ''}
}

export const setInfo = (userInfo) => {
    localStorage.setItem(USER_INFO, JSON.stringify(userInfo))
}

export const removeInfo = () => {
    localStorage.removeItem(USER_INFO)
}

export const getSid = () => {
    return Cookies.get(LOGIN_SID)
}
